<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="imports.jsp"%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" media="screen" type="text/css" title="style"
	href="style.css" />
<title>Super mega site d'e-commerce de livres</title>
</head>
<body>
	<div id="wrapper">
		<div id="header">
			<div id="logo">
				<h1>e-commerce de livres</h1>


			</div>

		</div>
		<!-- end #header -->
		<div id="menu">
			<jsp:include page="header.jsp" />
		</div>
		<!-- end #menu -->
		<div id="page">
			<div id="page-bgtop">
				<div id="page-bgbtm">


					<div id="content">
						<div class="post">
							<h2 class="title">Panier</h2>
							<div class="entry">

								<c:if test="${fn:length(cartMessage) == 1}">
									<p>L'enregistrement n'a pas pu se faire pour la raison
										suivante :</p>
									<p>${cartMessage[0]}</p>
								</c:if>
								<c:if test="${fn:length(cartMessage) > 1}">
									<p>L'enregistrement n'a pas pu se faire pour les raisons
										suivantes :</p>
									<ol>
										<c:forEach var="text" items="${cartMessage}">
											<li>${text}</li>
										</c:forEach>
									</ol>
								</c:if>
								<p></p>

								<form method="post" action="HandleOrder">
									<table width="90%">
										<tr>
											<th width="40%">Livre</th>
											<th width="20%">Quantité</th>
											<th width="20%">Prix unitaire</th>
											<th width="20%">Total</th>
										</tr>
										<c:forEach var="purchase" items="${cart.listArticles}">
											<tr>
												<td>Titre: ${purchase.key.title}<br />Auteur: ${purchase.key.author}
												</td>
												<td><input type="text"
													name="${purchase.key.id}Quantity" size="4"
													value="${purchase.value}" /></td>
												<td><fmt:formatNumber value="${purchase.key.price}"
														type="currency" currencySymbol="&euro;" /></td>
												<c:set var="totalarticle" value="${purchase.value*purchase.key.price}" />
												<td><fmt:formatNumber value="${totalarticle}" type="currency" currencySymbol="&euro;" /></td>
											
											</tr>
											<c:set var="total" value="${total+totalarticle}" />
										</c:forEach>
										<c:if test="${total==null}">
									<tr><td> VOTRE PANIER EST VIDE  </td><td></td><td></td><td></td></tr>
										</c:if>
										<tr><td></td><td></td><td></td><th>Total commande</th></tr>
										<tr><td></td><td></td><td></td><td>
										<input type="hidden" name="total" value="${total}">
										<fmt:formatNumber value="${total}" type="currency" currencySymbol="&euro;" />
										</td></tr>
									</table>
									<br />
									<input type="submit" name="submit"
										value="Enregistrer les modifications" /> <input type="submit"
										name="submit" value="Effectuer la commande" /><input type="submit" name="submit"
										value="Vider le panier" />
								</form>

							</div>


						</div>
						<div style="clear: both;">&nbsp;</div>
					</div>
					<!-- end #content -->
					<div id="sidebar">
						<ul>
							<jsp:include page="admin.jsp" />
							<jsp:include page="categories.jsp" />

						</ul>
					</div>
					<!-- end #sidebar -->
					<div style="clear: both;">&nbsp;</div>
				</div>
			</div>
		</div>
		<!-- end #page -->
	</div>
	<div id="footer">
		<p>Copyright (c) 2011. All rights reserved.</p>
	</div>
	<!-- end #footer -->
</body>
</html>

